package JUC;

import java.util.concurrent.CountDownLatch;

public class CountDownLatchDemo {

    public static void main(String[] args) throws InterruptedException {
        CountDownLatch count = new CountDownLatch(6);
        for (int i = 0; i < 6; i++) {

            new Thread(()->{
                System.out.println(Thread.currentThread().getName() +
                        "\t国，被灭。");
                count.countDown();
            }, String.valueOf(i).toString()).start();
            //}, CountryEnum.forEachCountry(i).toString()).start();
        }
        count.await();
        System.out.println(Thread.currentThread().getName() + "\t秦国统一华夏");
    }
}
